<!doctype html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>申请退换货</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" href="../libs/mui/mui.css" />
		<link rel="stylesheet" href="../libs/iconfont/fonts/iconfont.css"/>
		<link rel="stylesheet" type="text/css" href="../css/main.css"/>
		<style>
			.mui-content{font-size: 16px;}
			.mui-input-row label{width: 35%;}
			.mui-input-row label~input{width: 65%;}
			textarea{width: 100%!important;border: none;margin: 0;display: -webkit-box;padding: 0px 15px!important;}
			.bbs-pulish-img{background: white;display: -webkit-box;width: 100%;padding: 0 15px;}
			.bbs-pulish-img>img {width: 75px;height: 70px;max-height: 100px;padding: 5px;}
			.choose_item{position: relative;height: 40px;}
			.choose_item .mui-input-row{position: absolute;}
			.choose_item .mui-input-row:nth-child(1){left: 0;}
			.choose_item .mui-input-row:nth-child(2){left: 150px;}
		</style>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">申请退换货</h1>		
			<a class="mui-pull-right mui-icon"><h5 class="submits">提交</h5></a>
		</header>
		<div class="mui-content">
			<div class="Flea">
				<ul class="mui-table-view">
					<li class="mui-input-row">
						<label>订单编号：</label>
						<input type="text" class="order_sn" placeholder="请输入订单号"/>
					</li>
				</ul>
				<!--<ul class="mui-table-view">
					<li class="mui-input-row">
						<label>姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：</label>
						<input type="text" placeholder="请输入姓名"/>
					</li>
				</ul>-->
				<ul class="mui-table-view">
					<li class="mui-input-row">
						<label>联系电话：</label>
						<input type="text" class="contact_number" placeholder="请输入联系电话"/>
					</li>
				</ul>
				<ul class="mui-table-view">
					<li class="mui-input-row choose_item">						
						<div class="mui-input-row mui-radio mui-pull-left">
							<label id="W100">退货/退款</label>
							<input name="radio1" type="radio" class="refund_type" value="1">
						</div>
						<div class="mui-input-row mui-radio mui-pull-left">
							<label id="W100">换货</label>
							<input name="radio1" type="radio" class="refund_type" value="2">
						</div> 
					</li>
				</ul>
				<ul class="mui-table-view">
					<li class="mui-input-row">						
						<label id="W100">退换/货理由：</label>						
						<textarea name="" rows="4" cols="" class="buyer_message" placeholder="请输入退换/货理由"></textarea>
					</li>
				</ul>
				<ul class="mui-table-view" style="margin-top: 1px;">
					
				</ul>
			</div>
		</div>	
		<script src="../js/mui.js"></script>
		<script src="../js/open.js"></script>
		<script src="../libs/jquery/jquery.js"></script>
		<script type="text/javascript" src="../js/web_js/public.js" ></script>
		<script> 
			document.addEventListener('plusready',function(){
				var ws = plus.webview.currentWebview();
				var member_id = plus.storage.getItem('id');
				$('.submits').on('click',function(){
					var contact_number = $('.contact_number').val();
					var order_sn = $('.order_sn').val();
					var refund_type =  $("input[type='radio'][name='radio1']:checked").val();
					var buyer_message = $('.buyer_message').val();
//					console.log(order_sn+'--'+contact_number+'--'+refund_type+'--'+buyer_message);
					if(!contact_number){
						toast('请输入联系电话');return;
					}
					if(!contact_number.match(p1)){
						toast('请输入正确的联系电话');return;
					}
					if(!refund_type){
						toast('请选择退货退款类型！');return;
					}
					$.ajax({
						type:"post",
						url:apiRoot + "?act=member_refund&op=refund_all_post",
						data:{
							member_id:member_id,
							contact_number:contact_number,
							refund_type:refund_type,
							buyer_message:buyer_message,
							order_sn:order_sn
						},
						dataType:'json',
						success:function(data){
//							console.log(JSON.stringify(data));
							if(data.code == 200){
								toast('申请成功！');
								ws.close();
							}else{
								toast('提交失败 ！ '+data.datas.error);
							}
						},
						error:function(e){
							error();
						}
					});
					
				})
			})
		</script>
	</body>
</html>